using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class EmployeeMap : EntityTypeConfiguration<Employee>
	{
		public EmployeeMap()
		{
			// Primary Key
			this.HasKey(t => t.EmployeeID);

			// Properties
			this.Property(t => t.EmployeeCode)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.EmployeeOldCode)
				.HasMaxLength(20);
				
			this.Property(t => t.EmployeeName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.PassWord)
				.IsRequired()
				.HasMaxLength(100);
				
			this.Property(t => t.Address)
				.HasMaxLength(100);
				
			this.Property(t => t.Telephone)
				.HasMaxLength(50);
				
			this.Property(t => t.IDCard)
				.HasMaxLength(50);
				
			this.Property(t => t.RelationMan)
				.HasMaxLength(50);
				
			this.Property(t => t.RelationPhone)
				.HasMaxLength(50);
				
			this.Property(t => t.Relation)
				.HasMaxLength(50);
				
			this.Property(t => t.CellPhone)
				.HasMaxLength(15);
				
			this.Property(t => t.PostID)
				.HasMaxLength(50);
				
			this.Property(t => t.eEmail)
				.HasMaxLength(50);
				
			this.Property(t => t.PDACode)
				.HasMaxLength(20);
				
			this.Property(t => t.POSCode)
				.HasMaxLength(20);
				
			// Table & Column Mappings
			this.ToTable("Employee");
			this.Property(t => t.EmployeeID).HasColumnName("EmployeeID");
			this.Property(t => t.EmployeeCode).HasColumnName("EmployeeCode");
			this.Property(t => t.EmployeeOldCode).HasColumnName("EmployeeOldCode");
			this.Property(t => t.EmployeeName).HasColumnName("EmployeeName");
			this.Property(t => t.Sex).HasColumnName("Sex");
			this.Property(t => t.PassWord).HasColumnName("PassWord");
			this.Property(t => t.Address).HasColumnName("Address");
			this.Property(t => t.Telephone).HasColumnName("Telephone");
			this.Property(t => t.IDCard).HasColumnName("IDCard");
			this.Property(t => t.RelationMan).HasColumnName("RelationMan");
			this.Property(t => t.RelationPhone).HasColumnName("RelationPhone");
			this.Property(t => t.Relation).HasColumnName("Relation");
			this.Property(t => t.CellPhone).HasColumnName("CellPhone");
			this.Property(t => t.PostID).HasColumnName("PostID");
			this.Property(t => t.eEmail).HasColumnName("eEmail");
			this.Property(t => t.StationID).HasColumnName("StationID");
			this.Property(t => t.Deposit).HasColumnName("Deposit");
			this.Property(t => t.PDACode).HasColumnName("PDACode");
			this.Property(t => t.POSCode).HasColumnName("POSCode");
			this.Property(t => t.Sorting).HasColumnName("Sorting");
			this.Property(t => t.IsDeleted).HasColumnName("IsDeleted");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreateStationID).HasColumnName("CreateStationID");
			this.Property(t => t.CreateTime).HasColumnName("CreateTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateStationID).HasColumnName("UpdateStationID");
		}
	}
}

